package com.tencent.bk.utils.blueking.tools.ResultUtil;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.tencent.bk.utils.blueking.tools.enums.ResultEnums;

import java.io.Serializable;

/**
 * 返回结果实体
 *
 * @author GeniusJ
 * @email 975473185@qq.com
 * @date 2017-11-20
 * @time 9:43
 */
public class  ResultDto<T> implements Serializable {
    /**
     * 返回状态码
     */
    private int status;
    /**
     * 返回提示
     */
    private String msg;
    /**
     * 请求结果
     */
    private T data;

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    /**
     * 判断当前返回结果是否成功
     * @return
     */
    @JsonIgnore
    public boolean isSuccess(){
        return this.status == ResultEnums.SUCCESS.getCode();
    }
}
